import request from '@/config/axios'

// 分类级别 VO
export interface CategoryLevelVO {
  id: number // 主键ID
  levelName: string // 分类级别名称
  levelCode: string // 分类级别编码
  sort: number // 排序
  status: number // 状态
  remark: string // 备注
}

// 分类级别 API
export const CategoryLevelApi = {
  // 查询分类级别分页
  getCategoryLevelPage: async (params: any) => {
    return await request.get({ url: `/product/category-level/page`, params })
  },

  // 查询分类级别详情
  getCategoryLevelById: async (id: number) => {
    return await request.get({ url: `/product/category-level/getById?id=` + id })
  },

  // 新增分类级别
  createCategoryLevel: async (data: CategoryLevelVO) => {
    return await request.post({ url: `/product/category-level/create`, data })
  },

  // 修改分类级别
  updateCategoryLevel: async (data: CategoryLevelVO) => {
    return await request.post({ url: `/product/category-level/update`, data })
  },

  // 修改分类级别状态
  updateCategoryLevelStatus: async (id: number, status: number) => {
    const data = {
      id,
      status
    }
    return await request.post({ url: `/product/category-level/updateStatus`, data: data })
  },

  // 删除分类级别
  deleteCategoryLevelById: async (id: number) => {
    return await request.get({ url: `/product/category-level/delete?id=` + id })
  },

  // 导出分类级别 Excel
  exportCategoryLevel: async (params) => {
    return await request.download({ url: `/product/category-level/export-excel`, params })
  },
}
